<style>
.user-cate-list img {max-width:150px;max-height:150px;}
.user-cate-list td{vertical-align: middle !important;}
</style>
		<ol class="breadcrumb">
		  <li><a href="/users/index"><i class="fa fa-home"></i>&nbsp;&nbsp;个人中心</a></li>
		  {{if $_GET['model'] == 'Customer'}}
       		<li><a href="{{$this->Html->url('/customers/mine')}}">客户管理</a></li>
       		{{/if}}
		  <li class="active">分类列表</li>
		</ol>           
       <hr>
       <div class="mb10">
       {{if $_GET['model'] == 'WxStorefront' || $_GET['model'] == 'WxCityCate'}}
	       	<a class="btn btn-primary" href="{{$this->Html->url('/user_cates/add/WxStorefront')}}">新增门店分类</a>
	       	<a class="btn btn-primary" href="{{$this->Html->url('/wx_city_cates/mine?model=WxStorefront')}}">城市的门店分类</a>
	       	<a class="btn btn-primary" href="{{$this->Html->url('/wx_city_cates/add/WxStorefront')}}">新增城市门店分类</a>
       {{elseif $_GET['model'] == 'Customer'}}
       		<a class="btn btn-primary" href="{{$this->Html->url('/user_cates/add/Customer')}}">新增客户分类</a>
       {{elseif $_GET['model'] == 'WxMsg'}}
       		<a class="btn btn-primary" href="{{$this->Html->url('/user_cates/add/WxMsg')}}">新增文章分类</a>
       
       {{/if}}
       </div>
       
       <div class="alert alert-warning">提示：删除数据后，需要刷新才会从列表中消失。</div>
       
       
       <div class="ui-portlet user-cate-list">
    <table class="table table-striped table-hover">
    <?php
        $tableHeaders =  $this->Html->tableHeaders(array(
            '分类名称',
            //'所属模块',
            '创建时间',
			'最后编辑时间',
            '操作',
        ));

        echo '<thead>'.$tableHeaders.'</thead>';
        $rows = array(); 
        foreach ($datalist AS $item) {
            $actions = ' ' . $this->Html->link('<i class="fa fa-pencil"></i>修改', array('controller'=>'user_cates','action' => 'edit', $item['UserCate']['id']),array('escape'=>false));
			$actions .= ' ' . $this->Html->link('<i class="fa fa-remove"></i>删除', array('controller'=>'user_cates','action' => 'delete', $item['UserCate']['id']),array('onclick'=>"if(confirm('是否确认删除')) {ajaxAction(this.href);} return false;",'escape'=>false));
			
            $rows[] = array(
                ($item['UserCate']['coverimg']?'<img src="'.$this->Html->image($item['UserCate']['coverimg'],array('onlyurl'=>true)).'">':'').$item['UserCate']['name'],
                //$item['UserCate']['model'],
				$item['UserCate']['created'],
				$item['UserCate']['updated'],
                $actions,
            );
			foreach($item['children'] as $child)
			{
				$actions = ' ' . $this->Html->link('<i class="fa fa-pencil"></i>修改', array('controller'=>'user_cates','action' => 'edit', $child['UserCate']['id']),array('escape'=>false));
				$actions .= ' ' . $this->Html->link('<i class="fa fa-remove"></i>删除', array('controller'=>'user_cates','action' => 'delete', $child['UserCate']['id']),array('onclick'=>"if(confirm('是否确认删除')) {ajaxAction(this.href);} return false;",'escape'=>false));
			
            	$rows[] = array(
                	'▷ ▷'.($child['UserCate']['coverimg']?'<img src="'.$this->Html->image($child['UserCate']['coverimg'],array('onlyurl'=>true)).'">':'').$child['UserCate']['name'],
                    //$child['UserCate']['model'],
					$child['UserCate']['created'],
					$child['UserCate']['updated'],
               		$actions,
            	);
				foreach($child['children'] as $tchild)
			{
				$actions = ' ' . $this->Html->link('<i class="fa fa-pencil"></i>修改', array('controller'=>'user_cates','action' => 'edit', $tchild['UserCate']['id']),array('escape'=>false));
				$actions .= ' ' . $this->Html->link('<i class="fa fa-remove"></i>删除', array('controller'=>'user_cates','action' => 'delete', $tchild['UserCate']['id']),array('onclick'=>"if(confirm('是否确认删除')) {ajaxAction(this.href);} return false;",'escape'=>false));
			
            	$rows[] = array(
                	'▷ ▷▷ ▷'.($tchild['UserCate']['coverimg']?'<img src="'.$this->Html->image($tchild['UserCate']['coverimg'],array('onlyurl'=>true)).'">':'').$tchild['UserCate']['name'],
                    //$child['UserCate']['model'],
					$tchild['UserCate']['created'],
					$tchild['UserCate']['updated'],
               		$actions,
            	);
			}
			}
        }
        echo $this->Html->tableCells($rows);
    ?>
    </table>
    </div>